<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>缤格</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/binge.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/swiper.min.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<!-- index-header -->
<div id="header" style="height: 1.66rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 999">
    <div class="index-header">
        <div class="logo">
            <img src="../../image/icon-logo1.png" alt="">
        </div>
        <div class="search" tapmode onclick="commonUrl('search')">搜索用户、帖子、新闻...</div>
        <div class="icon-msg">
            <a href="javascript:void(0);" tapmode onclick="commonUrl('../member/msg')" class="msg-btn"><span
                    id="msgPoint" style="display: none;"></span></a>
        </div>
    </div>
    <!-- index-dynamic -->
    <div class="index-dynamic bg-fff" id="tab-list">
        <ul id="navList" class="">
            <li class="on "><a href="javascript:void(0);">头条</a></li>
            <li class=""><a href="javascript:void(0);">热门</a></li>
            <li class=""><a href="javascript:void(0);">考研</a></li>
            <li class=""><a href="javascript:void(0);">比赛</a></li>
            <li class=""><a href="javascript:void(0);">论文</a></li>
            <li class=""><a href="javascript:void(0);">985/211</a></li>
            <li class=""><a href="javascript:void(0);">比赛</a></li>
            <li class=""><a href="javascript:void(0);">论文</a></li>
            <li class=""><a href="javascript:void(0);">985/211</a></li>
        </ul>
    </div>
    <!-- index-dynamic end -->
</div>
<!-- index-header end -->


<!-- index-main -->
<div class="index-main mescroll" id="mescroll" style="padding-top: 2.4rem;">

    <div class="main-banner swiper-container">
        <ul class="swiper-wrapper" id="banner">
            <!--<li class="swiper-slide">
                <a href="##" tapmode onclick="commonUrl('news_detail')">
                    <img src="../../image/banner01.png" alt="">
                    <div class="swiper-info">
                        <p class="single-ellipsis">国庆阅兵仪式，中国军人最美的...</p>
                    </div>
                </a>
            </li>
            <li class="swiper-slide">
                <a href="##" tapmode onclick="commonUrl('news_detail')">
                    <img src="../../image/banner01.png" alt="">
                    <div class="swiper-info">
                        <p class="single-ellipsis">国庆阅兵仪式，中国军人最美的...</p>
                    </div>
                </a>
            </li>-->
        </ul>
        <div class="swiper-pagination"></div>
    </div>
    <div class="index-match" id="match" style="display: block;">
        <!--<ul class="kinds-1">
            <li tapmode onclick="commonUrl()">
                <div class="match-li-1">
                    <div class="match-school">
                        <div class="match-school-logo"><img src="../../image/school-logo01.png" alt=""></div>
                        <p class="school-name">澳门大学</p>
                    </div>
                    <div class="match-detail">
                        <h6 class="match-title multiline-ellipsis">足球杯1/8决赛</h6>
                        <p class="match-place single-ellipsis">广州中心体育馆</p>
                        <div class="match-num">12 - 14</div>
                        <span class="play-status status1"></span>
                    </div>
                    <div class="match-school">
                        <div class="match-school-logo"><img src="../../image/school-logo01.png" alt=""></div>
                        <p class="school-name">东南大学</p>
                    </div>
                </div>
            </li>
            <li tapmode onclick="commonUrl()">
                <div class="match-li-2">
                    <div class="match-school-logo"><img src="../../image/school-logo01.png" alt=""></div>
                    <div class="match-detail">
                        <h6>全国大学生舞蹈大赛</h6>
                        <p class="single-ellipsis">2019.12.31 北京艺术学院...</p>
                    </div>
                    <div class="play-status status1"></div>
                </div>
            </li>
        </ul>
        <ul class="kinds-2">

            <li tapmode onclick="commonUrl()">
                <div class="match-li-3">
                    <div class="match-title">
                        <h6 class="single-ellipsis">足球杯1/8决赛</h6>
                        <span class="play-status status1"></span>
                    </div>
                    <p class="match-addr single-ellipsis">广州中心体育馆</p>
                    <div class="match-detail">
                        <div class="match-school">
                            <div class="match-school-logo"><img src="../../image/school-logo01.png" alt=""></div>
                            <p class="school-name single-ellipsis">澳门大学</p>
                        </div>
                        <div class="match-num">122 - 142</div>
                        <div class="match-school">
                            <div class="match-school-logo"><img src="../../image/school-logo01.png" alt=""></div>
                            <p class="school-name single-ellipsis">澳门大学</p>
                        </div>
                    </div>
                </div>
            </li>
            <li>
                <div class="match-li-3">
                    <div class="match-title">
                        <h6 class="single-ellipsis">足球杯1/8决赛</h6>
                        <span class="play-status status2"></span>
                    </div>
                    <p class="match-addr single-ellipsis">广州中心体育馆</p>
                    <div class="match-detail">
                        <div class="match-school">
                            <div class="match-school-logo"><img src="../../image/school-logo01.png" alt=""></div>
                            <p class="school-name single-ellipsis">澳门大学</p>
                        </div>
                        <div class="match-num no-start">今天 13:00</div>
                        <div class="match-school">
                            <div class="match-school-logo"><img src="../../image/school-logo01.png" alt=""></div>
                            <p class="school-name ">澳门大学澳门大</p>
                        </div>
                    </div>
                </div>
            </li>
        </ul>-->
    </div>

    <div class="index-today">
        <div class="today-title">
            <h6><b id="ifToday">今</b>日话题</h6>
            <a href="javascript:void(0);" tapmode onclick="commonUrl('topic_before_list')" class="more-topic">更多话题></a>
        </div>
        <div class="topic-list">
            <ul id="discuss">
                <!--<li tapmode onclick="commonUrl('topic_detail')">
                    <h6 class="topic-title single-ellipsis">压力是否越大越好压力？</h6>
                    <p class="topic-num">22456人已参与</p>
                    <div class="topic-vote" style="display: none;">
                        <span class="vote choose1" tapmode onclick="choose(1,event)">学历</span>
                        <span class="vote choose2" tapmode onclick="choose(2,event)">经历</span>
                    </div>
                    <div class="choose-result" style="display: block;">
                        <div class="result1 result">
                            <div class="result-txt"><span class="icon">学历学历学历</span></div>
                            <div class="bar-line">
                                <div class="line" style="width: 70%;"></div>
                            </div>
                            <div class="percentage">70%</div>
                        </div>
                        <div class="result2 result">
                            <div class="result-txt"><span class="icon">学历学历</span></div>
                            <div class="bar-line">
                                <div class="line" style="width: 30%;"></div>
                            </div>
                            <div class="percentage">30%</div>
                        </div>
                    </div>
                </li>-->
            </ul>
        </div>
    </div>

    <div id="indexContent">

    </div>


</div>

<!-- index-main end -->


<!-- 底部导航 -->
<div id="footer" class="border-t">
    <ul class="flex-wrap">
        <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con active">首页</li>
        <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">圈子</li>
        <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">
            <div class="school-logo">
                <img id="school_path" src="" alt="">
            </div>
        </li>
        <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">赛事</li>
        <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">我的</li>
    </ul>
</div>


</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/mescroll.min.css"/>
<script type="text/javascript" src="../../script/mescroll.min.js"></script>
<script type="text/javascript">

    var category_id = '';//首页导航id
    var page = 1;//页码
    var pullUp = true;
    apiready = function () {

        setFixStatusBar(); //设置状态栏

        //监听返回键
        tabNavListener();

        //监听消息
        api.addEventListener({
            name: 'msgStatus'
        }, function (ret, err) {
            page = 1
            getIndexInfo()
        });

        api.addEventListener({
            name: 'topiclist'
        }, function (ret, err) {
            page = 1
            getIndexInfo()
        });

        api.sendEvent({
            name: 'closeCurrWinIndex',
        });


        //获取首页导航栏
        get_nav();

        //设置底部导航栏logo
        getMemberInfo()

        switchController()

        isIosX()

        ajpush()
    }


    function getMemberInfo() {
        var param = {
            token: $api.getStorage('token')
        }
        pop.loading();
        getAjax(Interface.memberIndex, param, function (res) {
            var data = res.data;
            $('#school_path').attr('src', ajaxUrl + data.school_path);
            $api.setStorage('schoolPath', ajaxUrl + data.school_path);

        }, function (error) {
            pop.close();
            pop.notice('读取数据失败');
        })
    }

    //获取首页导航栏
    function get_nav() {
        pop.loading();
        getAjax(Interface.get_nav, '', function (res) {
            var html = '';
            var list = res.data;
            if (isDefine(list)) {
                for (var i = 0; i < list.length; i++) {
                    if (i == 0) {
                        category_id = list[i].id;
                        html += '<li class="on" data-id="' + list[i].id + '"><a href="javascript:void(0);">' + list[i].title + '</a></li>';
                    } else {
                        html += '<li data-id="' + list[i].id + '"><a href="javascript:void(0);">' + list[i].title + '</a></li>';
                    }
                }
                $('#navList').html(html);
                //获取首页信息
                getIndexInfo();
            }
        }, function (error) {
            pop.notice(error.msg);
        })
    }


    //获取首页信息
    function getIndexInfo() {
        var param = {
            token: $api.getStorage('token'),
            category_id: category_id,
            page: page,
        }
        pop.loading()
        getAjax(Interface.index, param, function (res) {
            var banner = res.data.banner;
            //消息提示
            if (res.data.notice_num == 0) {
                $('#msgPoint').hide()
            } else {
                $('#msgPoint').show()
            }

            if (isDefine(banner)) {
                $(".main-banner").show();
                var bannerHtml = '';//banner图
                for (var i = 0; i < banner.length; i++) {
                    bannerHtml += '<li class="swiper-slide">' +
                        '                <a href="javascript:void(0);" class="bg-cover" style="background: url('+ajaxUrl + banner[i].icon_path[0]+')" onclick=\'toUrl("' + banner[i].url + '",'+banner[i].id+')\' tapmode data-id="' + banner[i].id + '">' +
                        // '                    <img src="' +  + '" alt="">' +
                        '                    <div class="swiper-info">' +
                        '                        <p class="single-ellipsis">' + banner[i].title + '</p>' +
                        '                    </div>' +
                        '                </a>' +
                        '            </li>';
                }
                $('#banner').html(bannerHtml);
                swiper.updateSlidesSize()
                swiper.reLoop()

            } else {
                $(".main-banner").hide();
            }
            var discuss = res.data.discuss;
            var discussHtml = '';//今日话题
            if (isDefine(discuss)) {
                $(".index-today").show()
                $("#ifToday").html(discuss.day_status)
                var result;
                var param = {"discuss_id": discuss.id, "today": 1};
                if (isDefine(discuss.so)) {
                    if (discuss.so == 1) {
                        result = '<div class="choose-result" style="display: block;"><div class="result1 result">' +
                            '                    <div class="result-txt"><span class="icon">' + discuss.just_title + '</span></div>' +
                            '                    <div class="bar-line">' +
                            '                         <div class="line" style="width: ' + discuss.rate + '%; background: #7dcec8"></div>' +
                            '                    </div>' +
                            '                    <div class="percentage" style="color: #7dcec8">' + discuss.rate + '%</div>' +
                            '</div></div>';
                    } else {
                        result = '<div class="choose-result" style="display: block;"><div class="result2 result">' +
                            '                    <div class="result-txt"><span class="icon">' + discuss.back_title + '</span></div>' +
                            '                    <div class="bar-line">' +
                            '                         <div class="line" style="width: ' + discuss.rate + '%; background: #fe7678"></div>' +
                            '                    </div>' +
                            '                    <div class="percentage" style="color: #fe7678">' + discuss.rate + '%</div>' +
                            '</div></div>';
                    }
                    discussHtml = '<li tapmode onclick=\'commonUrl("topic_detail",' + jsonChange(param) + ')\'>' +
                        '                    <h6 class="topic-title single-ellipsis">' + discuss.title + '</h6>' +
                        '                    <p class="topic-num">' + discuss.count + '人已参与</p>' + result + '</li>'
                } else {
                    discussHtml = '<li tapmode onclick=\'commonUrl("topic_detail",' + jsonChange(param) + ')\'>' +
                        '                    <h6 class="topic-title single-ellipsis">' + discuss.title + '</h6>' +
                        '                    <p class="topic-num">' + discuss.count + '人已参与</p>' +
                        '                    <div class="topic-vote" data-num="' + discuss.count + '">' +
                        '                        <span class="vote choose1" tapmode onclick="choose(' + discuss.id + ',1,event,this)">' + discuss.just_title + '</span>' +
                        '                        <span class="vote choose2" tapmode onclick="choose(' + discuss.id + ',0,event,this)">' + discuss.back_title + '</span>' +
                        '                    </div>' +
                        '                    <div class="choose-result">' +
                        '                        <div class="result1 result">' +
                        '                            <div class="result-txt"><span class="icon">' + discuss.just_title + '</span></div>' +
                        '                            <div class="bar-line">' +
                        '                                <div class="line" style="width: ' + discuss.rate + '%; background: #7dcec8"></div>' +
                        '                            </div>' +
                        '                            <div class="percentage" style="color: #7dcec8">' + discuss.rate + '%</div>' +
                        '                        </div>' +
                        '                        <div class="result2 result">' +
                        '                            <div class="result-txt"><span class="icon">' + discuss.back_title + '</span></div>' +
                        '                            <div class="bar-line">' +
                        '                                <div class="line" style="width: ' + discuss.rate + '%; background: #fe7678"></div>' +
                        '                            </div>' +
                        '                            <div class="percentage" style="color: #fe7678">' + discuss.rate + '%</div>' +
                        '                        </div>' +
                        '                    </div></li>'
                }
                $("#discuss").html(discussHtml)
            } else {
                $(".index-today").hide()
            }
            var list = res.data.list;
            if (isDefine(list)) {
                var listHtml = '';
                for (var i = 0; i < list.length; i++) {
                    //leixing： 1为新闻，2为帖子，3为活动
                    //是否置顶
                    var toUp = '';
                    var hotHtml = '';
                    if (list[i].leixing == 1 || list[i].leixing == 4) {
                        if (isDefine(list[i].data)) {
                            if (list[i].data.recommend == 1) {
                                toUp = '<span class="bt-pd toUp">置顶</span>';
                            }

                            var shield = '<div class="line_center" style="justify-content: space-between;">' +
                                '                                <div class="shield">' +
                                '                                    <span tapmode onclick=\'jubao('+list[i].data.id+',event,1)\'>举报</span>' +
                                '                                    <span tapmode onclick=\'shield('+list[i].data.id+',event,1,this)\'>屏蔽</span>' +
                                '                                </div>' +
                                '                                <div class="bottom-hot">' + list[i].data.hot_number + '</div>' +
                                '                            </div>';


                            if (isDefine(list[i].data.news_label_name)) {
                                if (list[i].data.news_label_name.length >= 2) {
                                    hotHtml = '<div class="detail-bottom">' +
                                        '              <div class="bottom-tips">' + toUp +
                                        '                  <span class="bt-pd tips" onclick=\'commonUrl("../index/news_list",{tips_id:' + list[i].data.news_label_name[0].id + '})\'>#' + list[i].data.news_label_name[0].title + '#</span>' +
                                        '                  <span class="bt-pd tips" onclick=\'commonUrl("../index/news_list",{tips_id:' + list[i].data.news_label_name[1].id + '})\'>#' + list[i].data.news_label_name[1].title + '#</span>' +
                                        '                  <span class="bt-pd time">' + list[i].data.date + '</span>' +
                                        '              </div>' + shield +
                                        '          </div>';
                                } else if (list[i].data.news_label_name.length == 1) {
                                    hotHtml = '<div class="detail-bottom">' +
                                        '              <div class="bottom-tips">' + toUp +
                                        '                  <span class="bt-pd tips" onclick=\'commonUrl("../index/news_list",{tips_id:' + list[i].data.news_label_name[0].id + '})\'>#' + list[i].data.news_label_name[0].title + '#</span>' +
                                        '                  <span class="bt-pd time">' + list[i].data.date + '</span>' +
                                        '              </div>' + shield +
                                        '          </div>';
                                }

                            } else {
                                hotHtml = '<div class="detail-bottom">' +
                                    '              <div class="bottom-tips">' + toUp +
                                    '                  <span class="bt-pd time">' + list[i].data.date + '</span>' +
                                    '              </div>' + shield +
                                    '          </div>';
                            }


                        }
                    } else if (list[i].leixing == 2) {

                    } else {
                        if (isDefine(list[i].data)) {
                            //顶置，标签，热度
                            if (list[i].data.recommend == 1) {
                                toUp = '<span class="bt-pd toUp">置顶</span>';
                            }
                            var tips = '';//标签
                            if (isDefine(list[i].data.cut_list)) {
                                for (var z = 0; z < list[i].data.cut_list.length; z++) {
                                    tips += '<span class="bt-pd tips">#' + list[i].data.cut_list[z] + '#</span>'
                                }
                            }
                            /*hotHtml = '<div class="detail-bottom">' +
                                '              <div class="bottom-tips">' + toUp + tips + '</div>' +
                                '              <div class="bottom-hot">' + list[i].data.hot_number + '</div>' +
                                '          </div>';*/
                            hotHtml = '<div class="detail-bottom">' +
                                '              <div class="bottom-tips">' + toUp + tips + '</div>' +
                                '               <div class="line_center" style="justify-content: space-between;">' +
                                '                                <div class="shield">' +
                                '                                    <span tapmode onclick=\'jubao('+listData.id+',event,4)\'>举报</span>' +
                                '                                    <span tapmode onclick=\'shield('+listData.id+',event,3,this)\'>屏蔽</span>' +
                                '                                </div>' +
                                '                                <div class="bottom-hot">' + listData.hot_number + '</div>' +
                                '                            </div>' +
                                '          </div>';
                        }
                    }

                    //用户信息
                    if (list[i].leixing != 1 && list[i].leixing != 4) {
                        var listData = list[i].data;
                        var userInfo = '';
                        if (isDefine(list[i].data)) {
                            var userData = listData.member;
                            var follow = '';//是否关注
                            var badgeList = '';//徽章列表


                            if (isDefine(userData.badge_path)) {
                                for (var k = 0; k < userData.badge_path.length; k++) {
                                    if (k <= 5) {
                                        badgeList += '<dd class="icon"><img src="' + ajaxUrl + userData.badge_path[k] + '" alt=""></dd>'
                                    }
                                }
                            }

                            if (isDefine(listData.self_status)) {

                                if (listData.self_status == 2) {
                                    var className = 'class' + userData.id;

                                    if (listData.member_follow == '0') {
                                        follow = '<div class="follow ' + className + '">' +
                                            '         <span class="no-follow"  tapmode onclick="followAction(1,' + userData.id + ',this)">关注</span>' +
                                            '         <span class="followed"  tapmode onclick="followAction(2,' + userData.id + ',this)">已关注</span>' +
                                            '     </div>'
                                    } else {
                                        follow = '<div class="follow ' + className + ' on">' +
                                            '         <span class="no-follow"  tapmode onclick="followAction(1,' + userData.id + ',this)">关注</span>' +
                                            '         <span class="followed"  tapmode onclick="followAction(2,' + userData.id + ',this)">已关注</span>' +
                                            '     </div>'
                                    }

                                    var user = {'member_id': userData.id};
                                    var report = {type: 5, pid: userData.id}
                                    var jubao = '<div class="jubao" onclick=\'commonUrl("../member/jubao",' + jsonChange(report) + ')\'>举报</div>'
                                    userInfo = '<div class="common-user-detail">' +
                                        '           <div class="user-info" tapmode onclick=\'commonUrl("../activity/person_index",' + jsonChange(user) + ')\'>' +
                                        '               <div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + userData.icon_path + ');"></div>' +
                                        '               <div class="info">' +
                                        '                    <div class="name">' +
                                        '                        <h6>' + userData.name + '</h6>' +
                                        '                        <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badgeList + '</dl>' +
                                        '                    </div>' +
                                        '                    <span class="time">' + listData.date + '</span>' +
                                        '                </div>' +
                                        '            </div><div class="user-action">' + jubao + follow + '</div></div>';
                                } else {

                                    userInfo = '<div class="common-user-detail">' +
                                        '           <div class="user-info" tapmode onclick=\'commonUrl("../member/member")\'>' +
                                        '               <div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + userData.icon_path + ');"></div>' +
                                        '               <div class="info">' +
                                        '                    <div class="name">' +
                                        '                        <h6>' + userData.name + '</h6>' +
                                        '                        <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badgeList + '</dl>' +
                                        '                    </div>' +
                                        '                    <span class="time">' + listData.date + '</span>' +
                                        '                </div>' +
                                        '            </div><div class="user-action">' + follow + '</div></div>';

                                }

                            }

                        }

                    }

                    //标题，文字，图片
                    var titleHtml = '';
                    if (list[i].leixing == 1 || list[i].leixing == 4) {
                        //新闻
                        if (isDefine(list[i].data)) {

                            if(list[i].leixing == 1){
                                var param = {"news_id": list[i].data.id}
                                var url = "../index/news_detail";
                            }else {
                                var param = {"war_id": list[i].data.id}
                                var url = "../match/match_detail";
                            }

                            if (isDefine(list[i].data.void_ids) && list[i].data.void_ids !=0) {
                                // var video_path = getVideoPic(ajaxUrl + list[i].data.void_ids);
                                var video_path = '';
                                //视频新闻
                                titleHtml = '<div class="video-detail">' +
                                    '             <h6 class="news-title multiline-ellipsis" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\'>' + list[i].data.title + '</h6>' +
                                    '             <div class="video-box bg-cover" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\' style="background-image: url(' + ajaxUrl + list[i].data.void_icon_path + ')";>' +
                                    '                 <p class="single-ellipsis"></p>' +
                                    '                 <span class="icon-play"></span>' +
                                    '                 <span class="time"></span>' +
                                    '              </div>' + hotHtml +
                                    '         </div>';

                            } else {
                                //三张图片新闻
                                if (isDefine(list[i].data.icon_path)) {
                                    if (list[i].data.icon_path.length >= 3) {
                                        titleHtml = '<div class="video-detail">' +
                                            '            <h6 class="news-title multiline-ellipsis" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\'>' + list[i].data.title + '</h6>' +
                                            '            <div class="detail-img-list" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\'>' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list[i].data.icon_path[0] + ');"></div>' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list[i].data.icon_path[1] + ');"></div>' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list[i].data.icon_path[2] + ');"></div>' +
                                            '            </div>' + hotHtml +
                                            '        </div>'
                                    } else if (list[i].data.icon_path.length == 2) {
                                        //两张图片新闻
                                        titleHtml = '<div class="video-detail">' +
                                            '            <h6 class="news-title multiline-ellipsis" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\'>' + list[i].data.title + '</h6>' +
                                            '            <div class="detail-img-list two-img" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\'>' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list[i].data.icon_path[0] + ');"></div>' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list[i].data.icon_path[1] + ');"></div>' +
                                            '            </div>' + hotHtml +
                                            '        </div>'
                                    } else if (list[i].data.icon_path.length == 1) {

                                        var shield = '<div class="line_center" style="justify-content: space-between;">' +
                                            '                                <div class="shield">' +
                                            '                                    <span tapmode onclick=\'jubao('+list[i].data.id+',event,1)\'>举报</span>' +
                                            '                                    <span tapmode onclick=\'shield('+list[i].data.id+',event,1,this)\'>屏蔽</span>' +
                                            '                                </div>' +
                                            '                                <div class="bottom-hot">' + list[i].data.hot_number + '</div>' +
                                            '                            </div>';


                                        if (isDefine(list[i].data.news_label_name)) {
                                            hotHtml = '<div class="detail-bottom">' +
                                                '              <div class="bottom-tips">' + toUp +
                                                '                  <span class="bt-pd tips" onclick=\'commonUrl("../index/news_list",{tips_id:' + list[i].data.news_label_name[0].id + '})\'>#' + list[i].data.news_label_name[0].title + '#</span>' +
                                                '                  <span class="bt-pd time">' + list[i].data.date + '</span>' +
                                                '              </div>' + shield +
                                                '          </div>';

                                        } else {
                                            hotHtml = '<div class="detail-bottom">' +
                                                '              <div class="bottom-tips">' + toUp +
                                                '                  <span class="bt-pd time">' + list[i].data.date + '</span>' +
                                                '              </div>' + shield +
                                                '          </div>';
                                        }


                                        //单张图片新闻
                                        titleHtml = '<div class="single-news">' +
                                            '             <div class="detail-img-list" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\'>' +
                                            '                 <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list[i].data.icon_path[0] + ');"></div>' +
                                            '             </div>' +
                                            '             <div class="video-detail">' +
                                            '                 <h6 class="news-title multiline-ellipsis_3" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\'>' + list[i].data.title + '</h6>' + hotHtml +
                                           /* '                 <p class="detail-info multiline-ellipsis" tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(param) + ')\'>' + list[i].data.brief + '</p>' + hotHtml +*/
                                            '             </div>' +
                                            '         </div>';
                                    }

                                }

                            }

                            listHtml += '<div class="index-news"><ul><li>' + titleHtml + '</li></ul></div>'
                        }


                    } else if (list[i].leixing == 2) {

                        //帖子
                        var listData = list[i].data;
                        if (isDefine(listData)) {
                            var titleHtml = '';
                            var userData = listData.member;
                            console.log(jsonChange(userData))

                            var userInfo = '';
                            var follow = '';//是否关注
                            var badgeList = '';//徽章列表
                            var toUp = '';//顶置
                            var hotHtml = '';//标签，热度

                            //顶置，标签，热度
                            if (listData.recommend == 1) {
                                toUp = '<span class="bt-pd toUp">置顶</span>';
                            }
                            var circleP = {"circle_id": listData.circle_id}

                            if(listData.self_status == 2){
                                hotHtml = '<div class="detail-bottom">' +
                                    '              <div class="bottom-tips">' + toUp +
                                    '                   <span class="bt-pd tips" tapmode onclick=\'commonUrl("../circle/circle_index",' + jsonChange(circleP) + ')\'>#' + listData.circle_title + '#</span></div>' +
                                    '               <div class="line_center" style="justify-content: space-between;">' +
                                    '                                <div class="shield">' +
                                    '                                    <span tapmode onclick=\'jubao('+listData.id+',event,3)\'>举报</span>' +
                                    '                                    <span tapmode onclick=\'shield('+listData.id+',event,2,this)\'>屏蔽</span>' +
                                    '                                </div>' +
                                    '                                <div class="bottom-hot">' + listData.hot_number + '</div>' +
                                    '                            </div>'+
                                    '          </div>';
                            }else {
                                hotHtml = '<div class="detail-bottom">' +
                                    '              <div class="bottom-tips">' + toUp +
                                    '                   <span class="bt-pd tips" tapmode onclick=\'commonUrl("../circle/circle_index",' + jsonChange(circleP) + ')\'>#' + listData.circle_title + '#</span></div>' +
                                    '               <div class="bottom-hot">' + listData.hot_number + '</div>'+
                                    '          </div>';
                            }


                            if (isDefine(userData.badge_path)) {
                                for (var k = 0; k < userData.badge_path.length; k++) {
                                    if (k <= 5) {
                                        badgeList += '<dd class="icon"><img src="' + ajaxUrl + userData.badge_path[k] + '" alt=""></dd>'
                                    }
                                }
                            }

                            if(isDefine(listData.self_status)){

                                if(listData.self_status == 2){
                                    var className = 'class'+userData.id;
                                    if (listData.member_follow == '0') {
                                        follow = '<div class="follow '+className+'">' +
                                            '         <span class="no-follow"  tapmode onclick="followAction(1,' + userData.id + ',this)">关注</span>' +
                                            '         <span class="followed"  tapmode onclick="followAction(2,' + userData.id + ',this)">已关注</span>' +
                                            '     </div>'
                                    } else {
                                        follow = '<div class="follow '+className+' on">' +
                                            '         <span class="no-follow"  tapmode onclick="followAction(1,' + userData.id + ',this)">关注</span>' +
                                            '         <span class="followed"  tapmode onclick="followAction(2,' + userData.id + ',this)">已关注</span>' +
                                            '     </div>'
                                    }

                                    var user = {'member_id': userData.id};
                                    var report = {type: 5,pid:userData.id}
                                    var jubao = '<div class="jubao" onclick=\'commonUrl("../member/jubao",'+jsonChange(report)+')\'>举报</div>'
                                    userInfo = '<div class="common-user-detail">' +
                                        '           <div class="user-info" tapmode onclick=\'commonUrl("../activity/person_index",' + jsonChange(user) + ')\'>' +
                                        '               <div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + userData.icon_path + ');"></div>' +
                                        '               <div class="info">' +
                                        '                    <div class="name">' +
                                        '                        <h6>' + userData.name + '</h6>' +
                                        '                        <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badgeList + '</dl>' +
                                        '                    </div>' +
                                        '                    <span class="time">' + listData.date + '</span>' +
                                        '                </div>' +
                                        '            </div><div class="user-action">' + jubao + follow + '</div></div>';
                                }else {

                                    userInfo = '<div class="common-user-detail">' +
                                        '           <div class="user-info" tapmode onclick=\'commonUrl("../member/member")\'>' +
                                        '               <div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + userData.icon_path + ');"></div>' +
                                        '               <div class="info">' +
                                        '                    <div class="name">' +
                                        '                        <h6>' + userData.name + '</h6>' +
                                        '                        <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badgeList + '</dl>' +
                                        '                    </div>' +
                                        '                    <span class="time">' + listData.date + '</span>' +
                                        '                </div>' +
                                        '            </div><div class="user-action">' + follow + '</div></div>';
                                }
                            }

                            var invitation_id = {'invitation_id': listData.id};
                            if (isDefine(listData.void_path)) {
                                //视频帖子
                                titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                    '             <h6 class="news-title multiline-ellipsis">' + listData.title + '</h6>' +
                                    '             <div class="video-box bg-cover" style="background-image: url(' + ajaxUrl + listData.void_icon_path + ')";>' +
                                    '                 <p class="single-ellipsis"></p>' +
                                    '                 <span class="icon-play"></span>' +
                                    '                 <span class="time"></span>' +
                                    '              </div>' + hotHtml +
                                    '         </div>';

                            } else {
                                if (isDefine(listData.icons_path)) {
                                    //三张图片帖子
                                    if (listData.icons_path.length >= 3) {
                                        titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                            '            <h6 class="news-title multiline-ellipsis">' + listData.title + '</h6>' +
                                            '            <div class="detail-img-list">' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + listData.icons_path[0] + ');"></div>' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + listData.icons_path[1] + ');"></div>' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + listData.icons_path[2] + ');"></div>' +
                                            '            </div>' + hotHtml +
                                            '        </div>'
                                    } else if (listData.icons_path.length == 2) {
                                        //两张图片帖子
                                        titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                            '            <h6 class="news-title multiline-ellipsis">' + listData.title + '</h6>' +
                                            '            <div class="detail-img-list two-img">' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + listData.icons_path[0] + ');"></div>' +
                                            '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + listData.icons_path[1] + ');"></div>' +
                                            '            </div>' + hotHtml +
                                            '        </div>'
                                    } else if (listData.icons_path.length == 1) {
                                        //单张图片帖子
                                        titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                            '              <h6 class="news-title multiline-ellipsis_3">' + listData.title + '</h6>' +
                                            '              <div class="video-box bg-cover" style="max-height: 6rem; padding-left: 0; padding-right: 0; justify-content: flex-start;"><img src="' + ajaxUrl + listData.icons_path[0] + '" alt=""></div>' + hotHtml + '</div>';
                                    }
                                } else {
                                    //无图
                                    titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                        '            <h6 class="news-title multiline-ellipsis">' + listData.title + '</h6>' + hotHtml +
                                        '        </div>'
                                }


                            }

                        }
                        listHtml += '<div class="index-news user-dynamic"><ul><li>' + userInfo + titleHtml + '</li></ul></div>'

                    } else if (list[i].leixing == 3) {
                        if (isDefine(list[i].data)) {
                            var listData = list[i].data;
                            var actHtml = '';//活动内容
                            var actStatus = '';//活动状态


                            if (listData.status == 1) {
                                actStatus = '<p class="status status1">报名中</p>'
                            } else if (listData.status == 2) {
                                actStatus = '<p class="status status3">进行中</p>'
                            } else if (listData.status == 3) {
                                actStatus = '<p class="status status2">已结束</p>'
                            } else {
                                actStatus = '<p class="status status2">已取消</p>'
                            }
                            var icon_img = ''
                            if(isDefine(listData.icons_path)){
                                icon_img = listData.icons_path[0]
                            }else {
                                icon_img = listData.background_path;
                            }
                            var activity = {'activity_id': listData.id};
                            actHtml = '<div class="flex-div" tapmode onclick=\'commonUrl("../activity/activity_index",' + jsonChange(activity) + ')\'>' +
                                '                    <div class="act-img bg-cover" style="background-image: url(' + ajaxUrl + icon_img + ')"></div>' +
                                '                    <div class="act-info">' +
                                '                        <h6 class="single-ellipsis">' + listData.title + '</h6>' +
                                '                        <div class="act-time">' +
                                '                            <p class="time">' + listData.week + ' ' + listData.start_date + '</p>' + actStatus + '</div>' +
                                '                        <div class="act-place">' +
                                '                            <p class="place">' + listData.address + '</p>' +
                                '                            <p class="num">' + listData.sum_number + '/' + listData.number + '</p>' +
                                '                        </div>' +
                                '                    </div>' +
                                '                </div>';

                            listHtml += '<div class="activity-list"><ul>' +
                                '<li style="border-bottom: 1px #f0f0f0 solid;" class="list-li">' + userInfo + actHtml + hotHtml + '</li>' +
                                '</ul></div>'
                        }

                    }

                }

                if (page == 1) {
                    $('#indexContent').html(listHtml)
                } else {
                    $('#indexContent').append(listHtml)
                }
                page++;
                pullUp = true;
                switchController()

            } else {
                if (page == 1) {
                    $('#indexContent').html(noData);
                } else {
                    $('#indexContent').append('<p style="width: 100%;" class="pt30 t-c c-999">没有更多了</p>')
                }
                pullUp = false;

            }

            if(isDefine(res.data.match)){
                var match = res.data.match.data;
                if(isDefine(match)){
                    var matchType = res.data.match.match_type;
                    var matchHtml = '';
                    $.each(match,function (i, item) {
                        var matchData = item.data;
                        if(matchType == 1){

                            var team1 = matchData.data[0];
                            var team2 = matchData.data[1];

                            var matchParam = {'match_id': matchData.id}

                            var url = '';
                            //type 1是篮球，2是足球
                            if(matchData.type == 1){
                                url = '../match/match_basketball';
                            }else {
                                url = '../match/match_football';
                            }
                            if(team1.branch == ''){
                                team1.branch = 0;
                            }


                            if(team2.branch == ''){
                                team2.branch = 0;
                            }

                            var sHtml = '';
                            var mHtml = '';
                            if(matchData.status == 1){
                                sHtml = '<div class="match-title"><h6 class="single-ellipsis">'+matchData.title+'</h6><span class="play-status status2"></span></div>';
                                mHtml = '<div class="match-num no-start">'+matchData.start_day+' '+matchData.start_date+'</div>';
                            }else if(matchData.status == 2){
                                sHtml = '<div class="match-title"><h6 class="single-ellipsis">'+matchData.title+'</h6><span class="play-status status1"></span></div>';
                                mHtml = '<div class="match-num">'+team1.branch+' - '+team2.branch+'</div>'
                            }else {
                                sHtml = '<div class="match-title"><h6 class="single-ellipsis">'+matchData.title+'</h6><span class="play-status status3"></span></div>';
                                mHtml = '<div class="match-num">'+team1.branch+' - '+team2.branch+'</div>'
                            }

                            matchHtml +='<li tapmode onclick=\'commonUrl("'+url+'",'+jsonChange(matchParam)+')\'>' +
                                '                <div class="match-li-3">' + sHtml +
                                '                    <p class="match-addr single-ellipsis">'+matchData.address+'</p>' +
                                '                    <div class="match-detail">' +
                                '                        <div class="match-school">' +
                                '                            <div class="match-school-logo"><img src="'+ajaxUrl + team1.team_path +'" alt=""></div>' +
                                '                            <p class="school-name ">'+team1.team_title+'</p>' +
                                '                        </div>' + mHtml +
                                '                        <div class="match-school">' +
                                '                            <div class="match-school-logo"><img src="'+ajaxUrl + team2.team_path +'" alt=""></div>' +
                                '                            <p class="school-name ">'+team2.team_title+'</p>' +
                                '                        </div>' +
                                '                    </div>' +
                                '                </div>' +
                                '            </li>';

                        }else {


                            if(item.leixing == 1){

                                var matchData = item.data;
                                var team1 = matchData.data[0];
                                var team2 = matchData.data[1];

                                var matchParam = {'match_id': matchData.id}

                                var url = '';
                                //type 1是篮球，2是足球
                                if(matchData.type == 1){
                                    url = '../match/match_basketball';
                                }else {
                                    url = '../match/match_football';
                                }
                                if(team1.branch == ''){
                                    team1.branch = 0;
                                }
                                if(team2.branch == ''){
                                    team2.branch = 0;
                                }

                                var mHtml = '';

                                if(matchData.status == 1){
                                    mHtml = '<span class="play-status status2"></span>';
                                }else if(matchData.status == 2){
                                    mHtml = '<span class="play-status status1"></span>';
                                }else {
                                    mHtml = '<span class="play-status status3"></span>';
                                }

                                matchHtml +='<li>' +
                                    '                <div class="match-li-1" tapmode onclick=\'commonUrl("'+url+'",'+jsonChange(matchParam)+')\'>' +
                                    '                    <div class="match-school">' +
                                    '                        <div class="match-school-logo"><img src="'+ajaxUrl+team1.team_path+'" alt=""></div>' +
                                    '                        <p class="school-name">'+team1.team_title+'</p>' +
                                    '                    </div>' +
                                    '                    <div class="match-detail">' +
                                    '                        <h6 class="match-title multiline-ellipsis">'+matchData.title+'</h6>' +
                                    '                        <p class="match-place single-ellipsis">'+matchData.address+'</p>' +
                                    '                        <div class="match-num">'+team1.branch+' - '+team2.branch+'</div>' + mHtml +
                                    '                    </div>' +
                                    '                    <div class="match-school">' +
                                    '                        <div class="match-school-logo"><img src="'+ajaxUrl+team2.team_path+'" alt=""></div>' +
                                    '                        <p class="school-name">'+team2.team_title+'</p>' +
                                    '                    </div>' +
                                    '                </div>' +
                                    '            </li>';

                            }else {

                                var matchParam = {'match_id': matchData.id}
                                var sHtml = '';
                                if(matchData.status == 1){
                                    sHtml = ' <div class="play-status status2"></div>';
                                }else  if(matchData.status == 2){
                                    sHtml = ' <div class="play-status status1"></div>';
                                }else {
                                    sHtml = ' <div class="play-status status3"></div>';
                                }

                                matchHtml += '<li>' +
                                    '                <div class="match-li-2" tapmode onclick=\'commonUrl("../match/team_match_detail",'+jsonChange(matchParam)+')\'>' +
                                    '                    <div class="match-school-logo"><img src="'+ajaxUrl+matchData.icon_path+'" alt=""></div>' +
                                    '                    <div class="match-detail">' +
                                    '                        <h6>'+matchData.title+'</h6>' +
                                    '                        <p class="single-ellipsis">2019.12.31 '+matchData.address+'</p>' +
                                    '                    </div>' + sHtml +
                                    '                </div>' +
                                    '            </li>'

                            }

                        }

                    })
                    var matchHtml_end = '';
                    if(matchType == 1){
                        console.log(matchType)
                        matchHtml_end = '<ul class="kinds-2">'+matchHtml+'</ul>';
                    }else {
                        matchHtml_end = '<ul class="kinds-1">'+matchHtml+'</ul>';
                        console.log(matchType)
                    }

                    $("#match").show();
                    $("#match").html(matchHtml_end);
                }else {
                    $("#match").hide();
                }


            }else {
                $("#match").hide();
            }

            pop.close();

            mescroll.endErr();

        }, function (error) {
            pop.notice(error.msg);
            pop.close();
            mescroll.endErr();

        })
    }

    //banner链接跳转
    function toUrl(url,id) {
        if(isDefine(url)){
          var urlParam = {"url": url}
          commonUrl('banner_detail', urlParam);
        }else{
          var urlParam = {"news_id":id}
          commonUrl('../index/news_detail', urlParam);
        }

    }

    //关注、取消关注
    function followAction(stype, pid, that) {
        var type = 1;//类型：1会员 2圈子

        var className = '.class' + pid;

        follow(stype, type, pid, function (res) {
            if (stype == 1) {
                pop.notice('关注成功');
                $(className).addClass('on')
                // $(that).parents('.follow').addClass('on')
            } else {
                pop.notice('已取消关注');
                $(className).removeClass('on')
                // $(that).parents('.follow').removeClass('on')
            }
        })
    }


    //首页导航栏目 tab 切换
    $("#tab-list").on('click', 'li', function () {
        var _this = $(this);
        var id = _this.attr('data-id');
        _this.addClass('on').siblings('li').removeClass('on');
        page = 1;
        $("#indexContent").html('');
        category_id = id;
        getIndexInfo()
    });


    //今日话题投票
    function choose(discuss_id, type, event, that) {
        event.stopPropagation();
        var _this = that;
        var param = {
            token: $api.getStorage('token'),
            discuss_id: discuss_id,
            type: type,
        }
        getAjax(Interface.discuss_vote, param, function (res) {
            var rate = res.data.rate;
            var topicNum = Number($(_this).parents('.topic-vote').attr('data-num')) + 1;
            if (type == 1) {
                //赞成
                $(_this).parents('.topic-vote').hide().siblings('.choose-result').show().find('.result2').hide();
            } else {
                //反对
                $(_this).parents('.topic-vote').hide().siblings('.choose-result').show().find('.result1').hide();
            }
            $(_this).parents('.topic-vote').siblings('.choose-result').find('.line').css({width: rate + '%'});
            $(_this).parents('.topic-vote').siblings('.choose-result').find('.percentage').html(rate + '%');
            $(_this).parents('.topic-vote').siblings('.topic-num').html(topicNum + '人已参与');
            pop.notice(res.msg)
        }, function (error) {
            pop.notice(error.msg)
        })
    }


    var swiper = new Swiper('.main-banner', {
        autoplay: 5000,
        observer: true,//修改swiper自己或子元素时，自动初始化swiper
        observeParents: true,//修改swiper的父元素时，自动初始化swiper
        pagination: '.main-banner .swiper-pagination',
        loop: true,
        autoplayDisableOnInteraction: false,
    })

    //创建MeScroll对象
    var mescroll = new MeScroll("mescroll", {
        down: {
            auto: false, //是否在初始化完毕之后自动执行下拉回调callback; 默认true
            callback: downCallback //下拉刷新的回调
        },
        up: {
            auto: false, //是否在初始化时以上拉加载的方式自动加载第一页数据; 默认false
            isBounce: true, //此处禁止ios回弹,解析(务必认真阅读,特别是最后一点): http://www.mescroll.com/qa.html#q10// 若为false ,页面上其他地方的滑动都滑不动
            callback: upCallback, //上拉回调,此处可简写; 相当于 callback: function (page) { upCallback(page); }
            /*toTop:{ //配置回到顶部按钮
                src : "../res/img/mescroll-totop.png", //默认滚动到1000px显示,可配置offset修改
                //offset : 1000
            }*/
        }
    });

    /*下拉刷新的回调 */
    function downCallback() {
        page = 1;
        getIndexInfo()
        //mescroll.endErr();
    }

    /*上拉加载的回调 */
    function upCallback() {
        if (pullUp == true) {
            getIndexInfo()
        } else {
            mescroll.endErr();
        }
    }


</script>
